home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 3.6 KB | 112 lines | [TEXT/CWIE] |
- // GrafPortObject.h
-
- #ifndef GrafPortObject_h
- #define GrafPortObject_h
-
- #ifndef Rectangle_h
- #include "Rectangle.h"
- #endif
- #ifndef FontNumber_h
- #include "FontNumber.h"
- #endif
- #ifndef FontSize_h
- #include "FontSize.h"
- #endif
- #ifndef SourceMode_h
- #include "SourceMode.h"
- #endif
- #ifndef PatternMode_h
- #include "PatternMode.h"
- #endif
- #ifndef Face_h
- #include "Face.h"
- #endif
-
- class GrafPortObject: public GrafPort
- {
- private:
- // not implemented:
- GrafPortObject( const GrafPortObject& );
- void operator=( const GrafPortObject& );
-
- CGrafPort& UncheckedColorCast()
- { return *reinterpret_cast<CGrafPort*>( this ); }
-
- const CGrafPort& UncheckedColorCast() const
- { return *reinterpret_cast<const CGrafPort*>( this ); }
-
- public:
- GrafPortObject();
- ~GrafPortObject();
-
- static GrafPortObject& Current() { return static_cast<GrafPortObject&>( *qd.thePort ); }
- bool IsCurrent() const { return this == &Current(); }
- void BeCurrent() { SetPort( this ); }
-
- bool InColor() const { return (portBits.rowBytes & 0x8000) != 0; }
-
- CGrafPort& ColorCast() { Assert( InColor() ); return UncheckedColorCast(); }
- const CGrafPort& ColorCast() const { Assert( InColor() ); return UncheckedColorCast(); }
-
- Rectangle LocalBitMapBounds() const;
-
- Rectangle LocalBounds() const { return portRect; }
- Rectangle GlobalBounds() const;
-
- PointObject LocalToGlobal() const;
- PointObject GlobalToLocal() const;
-
- RgnHandle VisibleRegion() const { return visRgn; }
-
- const Pattern& BackgroundPattern() const { return bkPat; }
- const Pattern& FillPattern() const { return fillPat; }
-
-
- void SetPenPosition( PointObject p ) { Assert( IsCurrent() ); MoveTo( p.h, p.v ); }
- PointObject PenPosition() const { return pnLoc; }
-
- void SetPenSize( PointObject p ) { Assert( IsCurrent() ); ::PenSize( p.h, p.v ); }
- PointObject PenSize() const { return pnSize; }
-
- void SetPenMode( PatternMode mode ) { Assert( IsCurrent() ); ::PenMode( mode.Value() ); }
- PatternMode PenMode() const { return PatternMode::Make( pnMode ); }
-
- void SetPenPattern( const ::Pattern& p ) { Assert( IsCurrent() ); PenPat( &p ); }
- const Pattern& PenPattern() const { return pnPat; }
-
- void HidePen() { Assert( IsCurrent() ); ::HidePen(); }
- void ShowPen() { Assert( IsCurrent() ); ::ShowPen(); }
- bool PenVisible() const { return pnVis >= 0; }
- int16 PenHidingLevel() const { return -pnVis; }
-
- RGBColor ForegroundColor() const;
- void SetForegroundColor( const RGBColor& c ) { Assert( IsCurrent() ); RGBForeColor( &c ); }
-
- RGBColor BackgroundColor() const;
- void SetBackgroundColor( const RGBColor& c ) { Assert( IsCurrent() ); RGBBackColor( &c ); }
-
-
- void SetFont( FontNumber font ) { Assert( IsCurrent() ); TextFont( font.Value() ); }
- FontNumber Font() const { return FontNumber::Make( txFont ); }
-
- void SetTextSize( FontSize size ) { Assert( IsCurrent() ); ::TextSize( size.Value() ); }
- FontSize TextSize() const { return FontSize::Make( txSize ); }
-
- void SetStyle( ::Style style ) { Assert( IsCurrent() ); TextFace( style ); }
- ::Style Style() const { return txFace; }
-
- void SetFace( const ::Face& );
- ::Face Face() const;
-
- void SetTextMode( SourceMode mode ) { Assert( IsCurrent() ); ::TextMode( mode.Value() ); }
- SourceMode TextMode() const { return SourceMode::Make( txMode ); }
-
- void SetSpaceStretch( Fixed stretch ) { Assert( IsCurrent() ); SpaceExtra( stretch ); }
- Fixed SpaceStretch() const { return spExtra; }
-
- void SetCharacterStretch( Fixed stretch );
- Fixed CharacterStretch() const;
- };
-
- #endif
-